<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">

            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="渠道">
                <j-dict-select-tag placeholder="请选择渠道" v-model="queryParam.system" dictCode="channel_type"/>
              </a-form-item>
            </a-col>
            <a-col :xl="8" :lg="9" :md="10" :sm="24">
              <a-form-item label="注册时间">
                <j-date :show-time="true"  date-format="YYYY-MM-DD" placeholder="请选择开始时间" v-model="queryParam.begintime"></j-date> 至
                <j-date :style="display='inline'" :show-time="true" date-format="YYYY-MM-DD" placeholder="请选择结束时间" v-model="queryParam.endtime"></j-date>
              </a-form-item>
            </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
<!--              <a-button type="primary" style="margin-left: 5px" icon="download" @click="handleExportXls('开心网吧提现')">导出</a-button>-->
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>

            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->



    <!-- table区域-begin -->
    <div>
      <!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div> -->

      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        class="j-table-force-nowrap"
        @change="handleTableChange">

        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
          <a-button
            v-else
            :ghost="true"
            type="primary"
            icon="download"
            size="small"
            @click="downloadFile(text)">
            下载
          </a-button>
        </template>


      </a-table>
    </div>

    <
  </a-card>
</template>

<script>

  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import { deleteAction, getAction,downFile,getFileAccessHttpUrl } from '@/api/manage'
  import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'

  export default {
    name: 'UserExistList',
    mixins:[JeecgListMixin, mixinDevice],
    components: {

    },
    data () {
      return {
        description: '用户留存管理页面',
        // 表头
        columns: [
          /*{
            title: '序号',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },*/
          {
            title:'时间',
            align:"center",
            dataIndex: 'firstDay'
          },
          {
            title:'注册用户数',
            align:"center",
            dataIndex: 'userCount'
          },
          {
            title:'次留(d2)',
            align:"center",
            dataIndex: 'day2'
          },
          {
            title:'d3',
            align:"center",
            dataIndex: 'day3'
          },
          {
            title:'d4',
            align:"center",
            dataIndex: 'day4'
          },
          {
            title:'d5',
            align:"center",
            dataIndex: 'day5'
          },
          {
            title:'d6',
            align:"center",
            dataIndex: 'day6'
          },
          {
            title:'d7',
            align:"center",
            dataIndex: 'day7'
          },
          {
            title:'d14',
            align:"center",
            dataIndex: 'day14'
          },
          {
            title:'d15',
            align:"center",
            dataIndex: 'day15'
          },
          {
            title:'d16',
            align:"center",
            dataIndex: 'day16'
          },
          {
            title:'d30',
            align:"center",
            dataIndex: 'day30'
          }
        ],
        url: {
          list: "/user/exist/list",
        },
        dictOptions:{},
        superFieldList:[],
        btnIsActive1:true,
        btnIsActive2:false,
      }
    },
    created() {
      //document.getElementById("#btn1").addClass= 'btnclass';
    this.getSuperFieldList();

    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      }
    },
    watch:{
      '$route'(to,from){//监听路由是否变化
        if(to.params.exist!=from.params.exist){
          //console.log('菜单路由参数to:'+to.params.code+',from:'+from.params.code);
          this.url.list='/user/exist/list?num='+to.params.exist;
          this.loadData();
        }
        console.log('路径2:'+this.url.list);

      }
    },
    methods: {
      initDictConfig(){
      },
      getSuperFieldList(){
        let fieldList=[];
        fieldList.push({type:'date',value:'firstDay',text:'时间',dictCode:''})
        fieldList.push({type:'string',value:'userCount',text:'注册用户数',dictCode:''})
        fieldList.push({type:'string',value:'day2',text:'次留(d2)',dictCode:''})
        fieldList.push({type:'string',value:'day3',text:'d3',dictCode:''})
        fieldList.push({type:'string',value:'day4',text:'d4',dictCode:''})
        fieldList.push({type:'string',value:'day5',text:'d5',dictCode:''})
        fieldList.push({type:'string',value:'day6',text:'d6',dictCode:''})
        fieldList.push({type:'string',value:'day7',text:'d7',dictCode:''})
        fieldList.push({type:'string',value:'day14',text:'d14',dictCode:''})
        fieldList.push({type:'string',value:'day15',text:'d15',dictCode:''})
        fieldList.push({type:'string',value:'day16',text:'d16',dictCode:''})
        fieldList.push({type:'string',value:'day30',text:'d30',dictCode:''})
        this.superFieldList = fieldList
      },
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';

</style>